<template>
  <div class="footer-container">
    <!-- 左侧的全选 -->
    <div class="custom-control custom-checkbox">
      <input
        type="checkbox"
        class="custom-control-input"
        id="cbFull"
        :checked="isfull"
        @change="fullChange"
      />
      <label class="custom-control-label" for="cbFull">全选</label>
    </div>

    <!-- 中间的合计 -->
    <div>
      <span>合计：</span>
      <span class="total-price">￥{{ totalprice }}</span>
    </div>

    <!-- 结算按钮 -->
    <button
      type="button"
      class="btn btn-primary btn-settle"
      @click="ToastFun()"
    >
      结算（{{ all }}）
    </button>
  </div>
</template>
<script>
import { Toast } from 'vant'
import { mapGetters } from 'vuex'
export default {
  props: {
    // 全选的状态
    isfull: {
      type: Boolean,
      default: true,
    },
    // 总价格
    totalprice: {
      type: [Number, String],
      default: 0,
    },
    // 已勾选的商品的总数量
    all: {
      type: Number,
      default: 0,
    },
  },
  computed: {},
  methods: {
    ToastFun() {
      Toast('敬请期待！')
    },
    // 监听到了全选的状态变化
    fullChange(e) {
      this.$emit('full-change', e.target.checked)
    },
  },
}
</script>

<style lang="less" scoped>
.footer-container {
  font-size: 0.4rem;
  height: 1.2rem;
  width: 100%;
  border-top: 1px solid #efefef;
  position: fixed;
  bottom: 0;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding: 0 0.1rem;
}

.custom-checkbox {
  display: flex;
  align-items: center;
}

#cbFull {
  margin-right: 0.1rem;
}

.btn-settle {
  height: 80%;
  min-width: 2.5rem;
  border-radius: 2rem;
  font-size: 0.36rem;
  border: none;
  color: #fff;
  background: #4e8ccd;
}

.total-price {
  font-weight: bold;
  font-size: 0.4rem;
  color: red;
}
</style>
